import java.util.ArrayList;
import java.util.List;

/**
 * @author: yangwk
 * @date: 2023/7/28
 * @description:
 **/
public class 质数 {
    public static void main(String[] args) {
        getDivide(68);
    }

    public static void getDivide(int tar) {
        List<Integer> divide = divide(tar);
        List<Integer> list = new ArrayList<>();
        while (tar != 1) {
            for (Integer integer : divide) {
                if (tar % integer == 0) {
                    tar = tar / integer;
                    list.add(integer);
                    break;
                }
            }
        }
        System.out.println(list);
    }

    public static List<Integer> divide(int tar) {
        List<Integer> list = new ArrayList<>();
        for (int i = 2; i <= tar; i++) {
            boolean find = true;
            for (int j = 2; j < i; j++) {
                if (i % j == 0) {
                    find = false;
                    break;
                }
            }
            if (find) {
                list.add(i);
            }
        }
        if (list.isEmpty()) {
            list.add(1);
            list.add(tar);
        }
        return list;
    }
}
